#include  <stdio.h>
#include  <dos.h>
#include  "doxon.h"
#include  "pcb.h"
#include  "thread.h"
#include  "endTest.h"

int semPreempt;

Consumer_::Consumer_():Thread(-1) {}

void Consumer_::run() {
    printf("End consumer1\n");
}

Consumer__::Consumer__():Thread(-1) {}

void Consumer__::run() {
    printf("End consumer2\n");
}
void tick() {}
int main(int argc, char *argv[])
{
    int i, j, m;

    printf("Program is starting\n");
    Doxon::init();

    Consumer_* cns1 = new Consumer_();
    Consumer__* cns2 = new Consumer__();

    cns1->start();
    cns2->start();

    for (i = 0; i < 3000; i++) {
        for (j = 0; j < 6000; j++)
            for (m = 0; m < 6000; m++);
        if ( i % 1000 == 0 ) {
            lock();
            printf("%d\n", i);
            unlock();
        }
    }


    printf("Almost happy end.\n");
    Doxon::halt();

    printf("Happy end.\n");
    return 0;
}
